//
//  UIBarButtonItem+Category.swift
//  SinaWeibo
//
//  Created by 许良 on 16/6/2.
//  Copyright © 2016年 fading. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    class func createBtnItem (imageName: String,target: AnyObject?, action: Selector, forControlEvents: UIControlEvents)-> UIBarButtonItem {
        let Btn = UIButton()
        Btn.setImage(UIImage(named: imageName), forState: .Normal)
        Btn.setImage(UIImage(named: imageName + "_highlighted"), forState: .Highlighted)
        Btn.addTarget(target, action: action, forControlEvents: forControlEvents)
        Btn.sizeToFit()
        return UIBarButtonItem(customView: Btn)
    }
}
